package com.fypg.module.medical.dal.mysql.hospital;

import java.util.*;

import com.fypg.framework.common.pojo.PageResult;
import com.fypg.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.fypg.framework.mybatis.core.mapper.BaseMapperX;
import com.fypg.module.medical.dal.dataobject.hospital.HospitalDO;
import org.apache.ibatis.annotations.Mapper;
import com.fypg.module.medical.controller.admin.hospital.vo.*;

/**
 * 医院信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface HospitalMapper extends BaseMapperX<HospitalDO> {

    default PageResult<HospitalDO> selectPage(HospitalPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HospitalDO>()
                .eqIfPresent(HospitalDO::getHospitalAreaId, reqVO.getHospitalAreaId())
                .eqIfPresent(HospitalDO::getEncode, reqVO.getEncode())
                .eqIfPresent(HospitalDO::getLevelType, reqVO.getLevelType())
                .eqIfPresent(HospitalDO::getGradeType, reqVO.getGradeType())
                .likeIfPresent(HospitalDO::getHospitalName, reqVO.getHospitalName())
                .eqIfPresent(HospitalDO::getBookingEarlyDays, reqVO.getBookingEarlyDays())
                .eqIfPresent(HospitalDO::getZipCode, reqVO.getZipCode())
                .eqIfPresent(HospitalDO::getTelephone, reqVO.getTelephone())
                .eqIfPresent(HospitalDO::getFax, reqVO.getFax())
                .eqIfPresent(HospitalDO::getOfficialSiteUrl, reqVO.getOfficialSiteUrl())
                .eqIfPresent(HospitalDO::getIntroduction, reqVO.getIntroduction())
                .eqIfPresent(HospitalDO::getAddress, reqVO.getAddress())
                .eqIfPresent(HospitalDO::getAvatarUrl, reqVO.getAvatarUrl())
                .eqIfPresent(HospitalDO::getLatitude, reqVO.getLatitude())
                .eqIfPresent(HospitalDO::getLongitude, reqVO.getLongitude())
                .likeIfPresent(HospitalDO::getShortName, reqVO.getShortName())
                .eqIfPresent(HospitalDO::getWebApi, reqVO.getWebApi())
                .eqIfPresent(HospitalDO::getPayType, reqVO.getPayType())
                .eqIfPresent(HospitalDO::getPayConfig, reqVO.getPayConfig())
                .eqIfPresent(HospitalDO::getIsCarPark, reqVO.getIsCarPark())
                .eqIfPresent(HospitalDO::getSortCode, reqVO.getSortCode())
                .eqIfPresent(HospitalDO::getDescription, reqVO.getDescription())
                .eqIfPresent(HospitalDO::getRemark, reqVO.getRemark())
                .eqIfPresent(HospitalDO::getSocialCreditCode, reqVO.getSocialCreditCode())
                .likeIfPresent(HospitalDO::getFullName, reqVO.getFullName())
                .eqIfPresent(HospitalDO::getHospitalLevel, reqVO.getHospitalLevel())
                .eqIfPresent(HospitalDO::getHospitalType, reqVO.getHospitalType())
                .betweenIfPresent(HospitalDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HospitalDO::getId));
    }

}